(in-package :graph-model)

(defclass label-mixin ()
  ((label :initarg :label :accessor label :initform nil)))

(defmethod print-object :after ((o label-mixin) stream)
  (when (label o)
    (format stream "<~A> " (label o))))

(defmethod change-label ((o label-mixin) newlabel)
  (setf (slot-value o 'label) newlabel))

(defmethod find-object-from-label (label (objects list) &key (test #'=))
  (find label objects :key #'label :test test))

(defmethod label ((o t)) nil)